package oa.service.impl;

import java.util.List;

import oa.dao.AttendanceDao;
import oa.dao.impl.AttendanceDaoImpl;
import oa.entity.Attendance;
import oa.exception.DaoException;
import oa.service.AttendanceService;

public class AttendanceServiceImpl implements AttendanceService {

	AttendanceDao attendanceDao = new AttendanceDaoImpl();

	@Override
	public List<Attendance> selectAllAttendance() {
		try {
			return attendanceDao.selectAllAttendance();
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<Attendance> selectAttendance(int deptId, int userId, int attendanceuserid) {
		try {
			return attendanceDao.selectAttendance(deptId, userId, attendanceuserid);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public boolean addAttendance(Attendance attendance) {
		try {
			return attendanceDao.addAttendance(attendance);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public boolean updateAttendance(Attendance attendance) {
		try {
			return attendanceDao.updateAttendance(attendance);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public boolean delAttendance(int id) {
		try {
			return attendanceDao.delAttendance(id);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public List<Attendance> selectTimeUserid(Attendance attendance) {
		try {
			return attendanceDao.selectTimeUserid(attendance);
		} catch (Exception e) {
			// TODO: handle exception
		}
		return null;
	}

	@Override
	public int selectCountList(String date,Attendance attendance) throws DaoException {
		try {
			return attendanceDao.selectCountList(date,attendance);
		} catch (Exception e) {
			// TODO: handle exception
		}
		return 0;

	}

	@Override
	public List<Attendance> selectStartTime(int userId, String startTime, String endTime) throws DaoException {
		try {
			return attendanceDao.selectStartTime(userId, startTime, endTime);
		} catch (DaoException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<Attendance> selectFenYe(int attendanceuserid, Integer pageNo, Integer row) {
		return attendanceDao.selectFenYe(attendanceuserid, pageNo, row);
	}

	@Override
	public int SecletCountSum(int attendanceuserid) {
		
		return attendanceDao.SecletCountSum(attendanceuserid);
	}

	@Override
	public int selectCountLists(String date, int ccompanyid) throws DaoException {
		return attendanceDao.selectCountLists(date, ccompanyid);
	}

}
